



CC:=g++
CPPFLAGS:=
CFLAGS:=

LIBRARY_PATH_DIRS := ../Common/library
LIBRARY_FILE_NAME := $(shell find $(LIBRARY_PATH_DIRS) -name "*.a")
LIBRARY_FILE_NAME := $(LIBRARY_FILE_NAME:$(LIBRARY_PATH_DIRS)/%=%)
LIBRARY_FILE_NAME := $(LIBRARY_FILE_NAME:lib%=-l%)
LIBRARY_FILE_NAME := $(LIBRARY_FILE_NAME:%.a=%)
CPPSTATIC:= #-L$(LIBRARY_PATH_DIRS) $(LIBRARY_FILE_NAME)

OBJECTS_PATH_DIRS := ../Common/objects
OBJECTS_FILE_NAME := $(shell find $(OBJECTS_PATH_DIRS) -name "*.o")
CPPOBJECT:= $(OBJECTS_FILE_NAME)

CODEDIR:=Code
OBJSDIR:=Objs
OUTSDIR:=Outs

MakeInit := $(shell mkdir -p $(OBJSDIR))
MakeInit := $(shell mkdir -p $(OUTSDIR))

# 搜索代码目录下的所有代码
srcs := $(shell find $(CODEDIR) -name "*.cpp")

# 替换后缀
objs := $(srcs:.cpp=.o)

# 替换目录
objs := $(objs:$(CODEDIR)/%=$(OBJSDIR)/%)

$(OBJSDIR)/%.o : $(CODEDIR)/%.cpp
	$(CC) $(CPPFLAGS) -c $< -o $@

build: $(objs)
	@echo $(LIBRARY_FILE_NAME)
	$(CC) $(CPPSTATIC) $(CPPOBJECT) $^ -o $(OUTSDIR)/Tray.elf

clear:
	@rm -rf $(OUTSDIR)/Tray.elf
	@rm -rf $(OUTSDIR)
	@rm -rf $(OBJSDIR)

#
show:
	@echo objs is[$(objs)]


